package com.ruoyi.core.domain.custombean;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.core.domain.ActivationCodeStatus;
import com.ruoyi.core.domain.SegmentTimeUnit;
import com.ruoyi.core.util.ActivationCodeGeneratorUtil;

import java.util.Date;

/**
 * @Description:
 * @Company: 北京卡拉卡尔股份技术有限公司
 * @Author: Darren Ho
 * @Date: 9/30/2020 14:31
 */
public class ActivationCodeDetailQueryResult {

    private Long id;

    private Long batchId;

    @JsonIgnore
    private String realCode;

    @Excel(name = "是否激活", readConverterExp = "AVAILABLE=激活,APPLIED=冻结")
    private ActivationCodeStatus status;

    /**
     * 时效片段
     */
    @Excel(name = "时效(天)")
    private Long segment;

    /**
     * 时效单位
     */
    private SegmentTimeUnit timeUnit;

    private Date createTime;

    @Excel(name = "权限数")
    private Integer products;

    @Excel(name = "激活码")
    private String code;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getBatchId() {
        return batchId;
    }

    public void setBatchId(Long batchId) {
        this.batchId = batchId;
    }

    public String getRealCode() {
        return realCode;
    }

    public void setRealCode(String realCode) {
        this.realCode = realCode;
        //        setCode(ActivationCodeGeneratorUtil.getVirtualCode(realCode));
        setCode(realCode);
    }

    public ActivationCodeStatus getStatus() {
        return status;
    }

    public void setStatus(ActivationCodeStatus status) {
        this.status = status;
    }

    public Long getSegment() {
        return segment;
    }

    public void setSegment(Long segment) {
        this.segment = segment;
    }

    public SegmentTimeUnit getTimeUnit() {
        return timeUnit;
    }

    public void setTimeUnit(SegmentTimeUnit timeUnit) {
        this.timeUnit = timeUnit;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Integer getProducts() {
        return products;
    }

    public void setProducts(Integer products) {
        this.products = products;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }
}
